# 题目参见图b2

while 1:
    a = int(input("鸡兔总头数"))
    b = int(input("鸡兔总腿数"))
    if b % 2 == 1:
        print("错误，腿数必须为偶数")
        continue
    # 鸡的数量
    x = 0
    # 兔的数量
    y = 0
    # x+y = a ,2*x + 4*y=b
    y = (b - 2 * a) / 2
    x = a - y
    print("鸡的数量%d,兔的数量%d" % (x, y))
